<?php
							session_start();
							if (isset($_SESSION['user_id']))
							{
							/*
								echo $_SESSION['user_id'] ;
								echo $_SESSION['username'] ;
								echo $_SESSION['email'];
								echo $_SESSION['loginname'];
								echo $_SESSION['password'];
								echo $_SESSION['avatarURL'];
								echo $_SESSION['position_id'];
								echo $_SESSION['key_id'] ;
								//session_destroy();
							*/
							}
							else
							{
								echo "<script>window.location.href = '../index.php'</script>";
							}
							
?>




<html>

	<title></title>
	<head>
     <?php 
             header('Content-type: text/html; charset=UTF-8') ;
        ?>
       
        <meta http-equiv="Content-type" value="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="../css/layout.css" type="text/css" />
		<script type="text/javascript" src="../js/load_project.js"></script>
		<script type="text/javascript" src="../js/load_bug_by_project.js"></script>
		<script type="text/javascript" charset="utf-8" src="../kindeditor/kindeditor.js"></script>
		<script type="text/javascript" src="../js/jquery.min.js"></script>
        <script type="text/javascript" src="../js/show_hide.js"></script>
		<script type="text/javascript">
			KE.show({
				id : 'txtBugDescription',
				resizeMode : 0,
				items : [
				'bold', 'italic', 'underline', 'textcolor','emoticons',
				'removeformat', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', 'image', 'link', 'unlink']
			});
		</script>
		<script type="text/javascript" src="../js/dropdownlist.js" ></script>
		<style>
			.middle{vertical-align:middle;}
		</style>

      


	</head>
	<body>
	<form id="frmAddBug" method="POST" action="../DATA/process_frmAddBug.php">
		<center>
					<p class="whiteLetter" style="font-size:25pt;padding-bottom:5px;cursor: pointer" onclick="backtomainscreen()">
						<b class="whiteLetter" style="font-size:39pt; font-family:Quinhon; src: url('font/QUINHON.ttf')format('truetype');">B</b>.ine
						<p class="whiteLetter" style="font-size:10.5pt;opacity:0.7;  margin-top:-5px; margin-bottom:10px">pine entertainment bug base</p>
					</p>
					
		</center>
		<div id="content">
			<table border="0" height="66px" style="margin:0 auto;">
						<tr>
							<td style="color:white; font-size:12.5px">Project&nbsp;&nbsp;</td>
							<td align="right" style="color:white; font-size:12.5px">
								<div class="styled-select-green">
									<select name="project" id="project"  class="combobox-green" onChange="this.value"> 
										<?php
										
											include("../DATA/config.php");
											$sql_select_project = "select * from project";
											mysql_query("SET NAMES 'utf8'");
											$result = mysql_query($sql_select_project);
										 
											while($row = mysql_fetch_array($result)) 
											{ 
												$project_id = $row["project_id"];
												$project_name = $row["project_name"];
												$deadline = $row["deadline"];	
                                                if ($_SESSION["current_project_id"]==$project_id)
                                                {
                                                    echo "<option value='$project_id' selected>$project_name</option>";
                                                }	
                                                else
                                                {
                                                    echo "<option value='$project_id'>$project_name</option>";
                                                }					
												
											}
										
										?>						
									</select>
								</div>
							</td>
							
							
							<td width="91">&nbsp;</td>
							<td width="98px" align="left"><input type="button" value="Add bug" class="button_addbug" onClick="" /></td>
							<td width="85">&nbsp;</td>
							<td width="200px" align="left" style="color:white">Bug ID&nbsp;&nbsp;<input style="color:rgb(0,116,38);width:116px;height:25px;border:0;" type="text" id="txtsearch" name="txtsearch" onChange="this.value"/><input type="button" value=" " class="button_search" onClick=""/></td>
							<td width="74">&nbsp;</td>
							<td align="left" width="25"><img title="Change avatar" src="<?php echo $_SESSION['avatarURL'] ; ?>" style="width:25px; height:25px; padding-right:10px;"/></td>
							<td colspan="4"align="left" style="color:white"><?php include("../DATA/convert_bugID.php"); $name = convert_name($_SESSION['username']);   echo strtoupper($name) ; ?></td>
							<!--
							<form method="POST" action="../DATA/process_frmLogout.php">
							<td align="center"><input class='button_login' type="submit" value="Logout!" style="display:none"/></td>
							</form>-->
						</tr>
					</table>	
		</div>
		<center>
			<table width="1024px" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td width="340px" style="background:rgb(242,242,242);vertical-align:text-top;padding-top:25px">
					
							<table border="0" cellpadding="0" cellspacing="10" class="font_add_bug" >
								<tr>
									<td width="70px">Device</td>
									<td align="right" style="color:white; font-size:12.5px">
										<div class="styled-select-grey">
											<select name="device" id="device"  class="combobox-grey" onChange="this.value"> 
												<?php
												
													include("../DATA/config.php");
													$sql_select_project = "select * from device";
													mysql_query("SET NAMES 'utf8'");
													$result = mysql_query($sql_select_project);
												 
													while($row = mysql_fetch_array($result)) 
													{ 
														$id = $row["device_id"];
														$name = $row["device_name"];
																				
														echo "<option value='$id'>$name</option>";
													}
												?>						
											</select>
										</div>
									</td>
								</tr>
								<tr>
									<td>Severity</td>
									<td align="right" style="color:white; font-size:12.5px">
										<div class="styled-select-grey">
											<select name="severity" id="severity"  class="combobox-grey" onChange="this.value"> 
												<?php
												
													include("../DATA/config.php");
													$sql_select_project = "select * from severity";
													mysql_query("SET NAMES 'utf8'");
													$result = mysql_query($sql_select_project);
												 
													while($row = mysql_fetch_array($result)) 
													{ 
														$id = $row["severity_id"];
														$name = $row["severity_name"];
														if ($id == 1)
                                                        {
                                                            $uid = $_SESSION['user_id'];
                                                            if ($uid == 1 || $uid == 5 || $uid == 8)
                                                            {
                                                                echo "<option value='$id'>$name</option>";
                                                            }
                                                        }
                                                        else
                                                        {
                                                            echo "<option value='$id'>$name</option>";
                                                        }						
														
													}
												?>						
											</select>
										</div>
									</td>
								</tr>
								<tr>
									<td>Category</td>
									<td align="right" style="color:white; font-size:12.5px">
										<div class="styled-select-grey">
											<select name="category" id="category"  class="combobox-grey" onChange="this.value"> 
												<?php
												
													include("../DATA/config.php");
													$sql_select_project = "select * from category";
													mysql_query("SET NAMES 'utf8'");
													$result = mysql_query($sql_select_project);
												 
													while($row = mysql_fetch_array($result)) 
													{ 
														$id = $row["category_id"];
														$name = $row["category_name"];
                                                        
                                                        
                                                        echo "<option value='$id'>$name</option>";
                                                        		
														
													}
												?>						
											</select>
										</div>
									</td>
								</tr>
								<tr>
									<td>Tech Repro</td>
									<td align="right" style="color:white; font-size:12.5px">
										<div class="styled-select-grey">
											<select name="techrepro" id="techrepro"  class="combobox-grey" onChange="this.value"> 
												<?php
												
													include("../DATA/config.php");
													$sql_select_project = "select * from techrepro order by techrepro_id desc";
													mysql_query("SET NAMES 'utf8'");
													$result = mysql_query($sql_select_project);
												 
													while($row = mysql_fetch_array($result)) 
													{ 
														$id = $row["techrepro_id"];
														$name = $row["techrepro_name"];
																				
														echo "<option value='$id'>$name</option>";
													}
												?>						
											</select>
										</div>
									</td>
								</tr>
							</table>
						
					</td>
					<td style="background:rgb(229,229,229);">
						<center>
							<table width="640px" border="0" cellpadding="0" cellspacing="10" class="font_add_bug" style="padding-top:25px;">
								<tr>
									<td width='50'>Bug title</td>
									<td colspan="2"><input type="text" name="txtBugTitle" class="font_add_bug" style="width:580px;height:25px"/></td>
								</tr>
								<tr>
									<td colspan="3" style="height: 320px">
                                       
                                            <textarea class="textareasize" id="txtBugDescription" name="txtBugDescription" placeholder="Description..."></textarea>
                                            
                                        
									</td>
									
								</tr>

								<tr>
									<td>Status</td>
									<td align="left" style="color:white; font-size:12.5px">
										<div class="styled-select-grey">
											<select name="status" id="status"  class="combobox-grey" onChange="this.value"> 
												<?php
												
													include("../DATA/config.php");
													$sql_select_project = "select * from status";
													mysql_query("SET NAMES 'utf8'");
													$result = mysql_query($sql_select_project);
												 
													while($row = mysql_fetch_array($result)) 
													{ 
														$id = $row["status_id"];
														$name = $row["status_name"];
																				
														echo "<option value='$id'>$name</option>";
													}
												?>						
											</select>
										</div>
									</td>
                                    <td></td>
								</tr>
								<tr>
									<td></td>
                                    <td></td>
									<td align="right"><input type="submit" value="Submit" class="submit_update_button"/></td>
								</tr>
								<tr>
									<td>&nbsp;</td>
									<td>&nbsp;</td>
                                    <td>&nbsp;</td>
								</tr>
							</table>
						</center>
					</td>
				</tr>
			</table>
		
			<p class="footer" style="padding-top:253px;"> 2013 Pine Entertainment. All rights reserved</p>
		<center>
	</form>
	</body>
</html>
